@extends('layouts.console_header')

@section('title', '待审核商家列表')

@section('resources')
    @parent

@endsection

@section('content')
<section class="user_list">
    <p class="fz_14 account_title">
        <span style="color: #7f7f7f;"><a href="/console/index">首页</a>>商家版运营></span>
        <span class="co_violet">待审核商家列表</span>
    </p>
    <table id="example" class="display" cellspacing="0" width="100%">
        <thead>
            <tr>
                <th>序号</th>
                <th>商家代码</th>
                <th>商家名称</th>
                <th>商家账号</th>
                <th>商务姓名</th>
                <!--<th>审核优先级</th>-->
                <!--<th>审核类型</th>-->
                <!--<th>提交内容</th>-->
                <th>提交时间</th>
                <th>操作</th>
            </tr>
        </thead>
        <tfoot>
            <tr>
                <th>序号</th>
                <th>商家代码</th>
                <th>商家名称</th>
                <th>商家账号</th>
                <th>商务姓名</th>
                <!--<th>审核优先级</th>-->
                <!--<th>审核类型</th>-->
                <!--<th>提交内容</th>-->
                <th>提交时间</th>
                <th>操作</th>

            </tr>
        </tfoot>
        <tbody>
            @foreach($lists as $list)
                <tr>
                @if(!isset($i))
                    <td>{{$i=1}}</td>
                @else
                    <td>{{++$i}}</td>
                @endif
                    {{--<td>{{$list['shopreviewid']}}</td>--}}
                    <td>{{$list['shopcode']}}</td>
                    <td>{{$list['shopname']}}</td>
                    <td>{{$list['parentmobile']}}</td>
                    <td>{{$list['managername']}}</td>
                    <!--<td>紧急</td>-->
                    <!--<td></td>-->
                    <!--<td></td>-->
                    <td>{{date('Y-m-d H:i', strtotime($list['created_at']))}}</td>
                    <td>
                        <a style="margin-right: 10px;" class="co_violet" href="/console/shop/review/get?cityid={{$cityid}}&shopreviewid={{$list['shopreviewid']}}&adminrole=customer">去审核</a>
                        <a class="co_red" href="#" onclick="delete_shop_review('{{$list['shopreviewid']}}', '{{$list['shopname']}}')">删除</a>
                    </td>
                </tr>
            @endforeach
        </tbody>
    </table>
</section>
@endsection

@section('scriptResources')
    @parent
    <script>
        var cityid='{{$cityid}}';
        function delete_shop_review(shopreviewid, shopname) {
            var is_confirm = confirm("确定要删除"+shopname);
            if(is_confirm) {
                $.ajax({
                    url : '/console/shop/review/customer/delete',
                    data:{cityid:cityid,shopreviewid:shopreviewid},
                    dataType:'json',
                    type:'post',
                    success:function(data){
                        if(data.status == 'success') {
                            alert('删除成功');
                            window.location.reload();
                        } else {
                            alert(data.message);
                        }
                    },
                    error: function(XMLHttpRequest, textStatus, errorThrown) {
                        alert(XMLHttpRequest.status);
                        alert(XMLHttpRequest.readyState);
                        alert(textStatus);
                    }
                });
            }
        }

    </script>
@endsection